package test.com;

import java.util.UUID;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

public class JedisGetSet{
	public static void main(String[] args) {
		ClassPathXmlApplicationContext ct = new ClassPathXmlApplicationContext("classpath:conf/spring/data/spring-data-jedis.xml");
		RedisTemplate<String, Object> redistemplate = (RedisTemplate<String, Object>) ct.getBean("redistemplate");
		ValueOperations<String, Object> vals1 = redistemplate.opsForValue();
		vals1.set("aaaaaaa", 323323);
		System.out.println((Integer) vals1.get("aaaaaaa"));
		redistemplate.delete("aaaaaaa");
		System.out.println((Integer) vals1.get("aaaaaaa"));
		ListOperations<String, Object> opslist = redistemplate.opsForList();
		
		Object str ;
		while((str = opslist.rightPop("abc"))!=null){
			
			System.out.println(str+"   "+opslist.size("abc"));
		}
		for (int i = 0; i < 1000000; i++) {
			opslist.leftPush("abc", UUID.randomUUID());
		}
//		ct.destroy();
//		ct.close();
		System.err.println(ct.getId());
	}

}
